package com.company.project.service.impl;

import com.company.project.dao.LegalMapper;
import com.company.project.model.Legal;
import com.company.project.service.LegalService;
import com.company.project.core.AbstractService;
import com.company.project.util.PageUtil;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;


/**
 * Created by CodeGenerator on 2019/07/19.
 */
@Service
@Transactional
public class LegalServiceImpl extends AbstractService<Legal> implements LegalService {
    @Resource
    private LegalMapper legalMapper;

    public int addLegal(Legal legal){
        return legalMapper.insert(legal);
    }

    @Override
    public PageUtil<Legal> getLegalPage(Integer pageIndex) {
        PageUtil<Legal> pageUtil = new PageUtil();
        pageUtil.setPageSize(10);
        pageUtil.setCpage(pageIndex);
        pageUtil.setTotalRow(legalMapper.selectCountLegal());
        pageUtil.setLists(legalMapper.selectLegalPage(pageUtil));
        return pageUtil;
    }

}
